//
// Created by wwl on 2021/11/28.
//
#include <stdio.h>
double fact(int n);
double factsum(int n);
void jiecheng(){
    int n;
    scanf("%d",&n);
    printf("fact(%d) = %.0lf\n",n,fact(n));
    printf("sum = %.0lf\n",factsum(n));

}
/*
 * n的阶乘
 */
double fact(int n){
    double ans;
    if(n>0){
        ans = n * fact(n-1);
    } else{
        ans = 1;
    }
    return ans;
}
/*
 * 总和
 */
double factsum(int n){
    double sum = 0;
    if(n>0){
        for (int i = n; i > 0; i--) {
            sum += fact(i);
        }
    } else{
        sum = 1;
    }
    return sum;
}
